class Person:   # 人类
    def __init__(self, name, money):
        self.name = name
        self.money = money

    def speak(self):
        return f"抢红包成功，我是{self.name}，现在有{self.money}块钱"


class Manager(Person):  # 群主
    def __init__(self, name, money):
        super().__init__(name, money)
        self.red_packet = []

    def send(self, num: int, money: int):
        print(f"群主发普通红包啦，红包数为{num}，单个红包金额为{money}")

        if self.money - (num * money) < 0:
            return f"发红包失败，群主为{self.name}，余额不足，当前余额为{self.money}，所需要的金额为{num * money}"

        self.money -= (num * money)     # 群主扣钱
        for i in range(num):
            self.red_packet.append(money)
        return f"发红包成功，群主为{self.name}，发红包的金额为{num * money}，当前余额为{self.money}"


class Member(Person):
    def get(self, manager):
        if manager.red_packet:  # 还有红包
            money = manager.red_packet.pop()
            self.money += money

            return super().speak()
        return f"红包已经被抢完了，我是{self.name}"


if __name__ == "__main__":
    manager = Manager("群主1", 100)

    member1 = Member("Tom", 1)
    member2 = Member("Jie", 20)

    print(manager.send(2, 10))

    print(member1.get(manager))
    print(member2.get(manager))